00001 00014 class Road 00015 { 00016 friend class RoadMap; 00017 private: 00018 00023 RoadType type; 00027 float width; 00031 float length; 00032 00037 osg::Vec3 controlPointArray[MaxNUMPOINTS]; 00038 00042 osg::Vec3Array *verts; 00043 00044 00048 int numControlPoints; 00049 00053 int numPoints; 00054 00059 int controlPointsIndex; 00060 00065 osg::ref_ptr<osg::Group> dotRoot; 00066 00070 osg::ref_ptr<osg::Group> lineRoot; 00071 00075 osg::ref_ptr<LinearConstraint> dc; 00076 00077 public: 00081 Road(RoadType theType); 00082 00083 ~Road() {}; 00084 00093 osg::Vec3 calculateCatmull(osg::Vec3 A, osg::Vec3 B, osg::Vec3 C,osg::Vec3 D, double t); 00094 00098 void setPoints(void); 00099 00103 void addDots(); 00104 00108 void addLines(void); 00109 00110 00117 void addNewPoint( osg::Vec3 pos ); 00118 00122 string* returnTextName(); 00123 00124 // dc'nin width-height ve verts variablelarini set eder. 00128 void geometryInitialize(); 00129 00134 void setWidthAndHeight(); 00135 00136 00137 }; 00138 00139 00140 00141 class RoadMap 00142 { 00143 friend class Road; 00144 public: 00153 RoadMap::RoadMap(osg::ref_ptr<osg::Group> sgroot); 00154 00161 void addRoadMaptoRoot(osg::ref_ptr<osg::Group> sgroot,int flag); 00162 00167 void loadRoadScene(void); 00168 00172 osg::Vec3d getpt(const int np); 00173 00179 osg::Group * makedelaunay(); 00180 00187 void addNewRoad(RoadType type); 00188 00193 void addPoint (osg::Vec3 position); 00194 00199 void setActiveRoadIndex(int index); 00200 00205 int getActiveRoadIndex(void); 00206 00210 int getLastRoadIndex(); 00211 00220 void pinControl(osg::ref_ptr<osg::Group> sgroot); 00221 00225 void clearRoadMap(); 00226 00230 osg::ref_ptr<osg::Group> returnRoadNode() {return roadRoot.get();} 00231 00237 void addRoadNode(osg::ref_ptr<osg::Node> roadNodeToBeAdded) ; 00238 00239 00240 00241 private: 00245 vector<Road *> roadMap; 00246 00250 int currentRoadIndex; 00251 00255 int lastRoadIndex; 00256 00260 int pinFlag; 00261 00265 osg::Vec3Array *points; 00266 00271 osg::ref_ptr<osg::Group> roadRoot; 00272 00276 osg::ref_ptr<osg::Group> dotRootNode; 00277 00281 osg::ref_ptr<osg::Group> lineRootNode; 00282 00287 osg::ref_ptr<osg::Group> linedotRoot; 00288 00293 osg::ref_ptr<osg::Group> savedMap; 00294 }; 00295
1.4.6-NO